IsDialogEvent
IsDialogEvent Check if an event belongs to a dialog window
#include <Dialogs.h> Dialog Manager
EventRecord *theEvent ; address of record used in GetNextEvent
returns Is this event related to a modeless dialog?
IsDialogEvent should be called directly after GetNextEvent if there are
any currently-open modeless dialogs. If the return value is TRUE, the next
step is to call DialogSelect and handle the event.
theEvent is the address of an EventRecord. Normally, this will contain the
data obtained by a call to GetNextEvent in your main event loop.
Returns: a Boolean value indicating whether the event occurred in a modeless
dialog window. It is one of:
FALSE (0) theEvent is unrelated to dialogs
TRUE (1) theEvent occurred in a dialog; use DialogSelect to find
which dialog and to handle the event.

Notes: You should call IsDialogEvent in your main event loop if you have opened
any modeless dialogs (see NewDialog and GetNewDialog). It is OK to call
this if all such dialogs are closed or haven't yet been opened - it just
returns FALSE.
The return value is TRUE if theEvent is an "activate" or " update" event for
any dialog window. If the active window is a dialog, the return value is
TRUE for all mouse-downs in its content region and all other events related
to the window.
In most cases, the next step is to call DialogSelect to see which dialog is
associated with theEvent and to handle the event. However, that function
doesn't handle -shifted keys or disk-insert events. Thus, you may need to
do some preprocessing of theEvent beforehand.
If all your dialogs are modal, events are handled immediately after the
dialog is displayed by a loop that calls ModalDialog and you won't need this
function.
Note: It is normal to call IsDialogEvent and DialogSelect in your
event loop even when GetNextEvent returns FALSE (no event). This
ensures correct blinking of the caret for editText items.
DAs: This call checks the windowKind field of the relevant
WindowRecord, looking for a 2 ( dialogKind). Since DAs must set their
reference number in this field, you must store 2 into dialog window's
windowKind field, call IsDialogEvent, and restore the value afterwards.
See DialogSelect for an example of usage.